package auth

import (
	"encoding/json"
	// "fmt"
	"server/lib/session"
)

func Auth(sess session.SESS) int {
	if sess["admin_info"] != "" {
		var admin_info map[string]string
		json.Unmarshal([]byte(sess["admin_info"]), &admin_info)
		if sess["admin_user"] == admin_info["username"] && sess["admin_passwd"] == admin_info["passwd"] {
			return 1
		}
	}
	return 0
}
